package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.PageRequestSensitiveDto;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController {
    @Autowired
    private WmSensitiveService wmSensitiveService;
    @PostMapping("/save")
    public ResponseResult<String> addSensitive(@RequestBody SensitiveDto dto){
        wmSensitiveService.addSensitive(dto);
        return ResponseResult.okResult("SUCCESS");
    }
    @PostMapping("/update")
    public ResponseResult<String> updateSensitive(@RequestBody SensitiveDto dto){
        wmSensitiveService.updateSensitive(dto);
        return ResponseResult.okResult("SUCCESS");
    }
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitiveById(@PathVariable Long id){
        wmSensitiveService.deleteSensitiveById(id);
        return ResponseResult.okResult("SUCCESS");
    }
    @PostMapping("/list")
    public PageResponseResult<WmSensitive> pageConditionQuery(@RequestBody PageRequestSensitiveDto dto){
        PageResponseResult<WmSensitive> result = wmSensitiveService.pageConditionQuery(dto);
        return result;
    }


}
